<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../bootstrap3/jquery-1.9.1.min.js"></script>
</head>
<body>

<a href="login.html" onclick="logout()">注销登录</a>



</body>
<script type="text/javascript">
    function logout(){
        $.ajax({
            url: "/login/logout",
            type: "POST",
            data: new FormData($("#form-change-avatar")[0]),
            dataType: "JSON",
            processData: false, // 关闭processData处理数据
            contentType: false, // 关闭contentType发送数据的格式
            success: function(json) {
                if (json.state == 200) {
                    location.href = "login.html";
                } else {
                    alert("登出失败！" + json.message);
                }
            },
            error: function(json) {
                alert("登出请求异常！状态码：" + json.status);
            }
        });
    }
</script>
</html>